
<?php get_main_menu("admin")?>
 <div> <a href="."><img src="images/back-button.png" width="30" height="30" title="Back" /></a><a href=".?material_add&action=Add">
  <img src="images/add-button.jpg" width="30" height="30" title="Add <?php echo $object_name ?>" /></a>
<?php
mysql_select_db($database_drycleaners_conn, $drycleaners_conn);
$query_get_material = "SELECT * FROM material";
$get_material = mysql_query($query_get_material, $drycleaners_conn) or die(mysql_error());
$row_get_material = mysql_fetch_assoc($get_material);
$totalRows_get_material = mysql_num_rows($get_material);

$colname_get_material_by_id = "-1";
if (isset($_GET['material_id'])) {
  $colname_get_material_by_id = $_GET['material_id'];
}
mysql_select_db($database_drycleaners_conn, $drycleaners_conn);
$query_get_material_by_id = sprintf("SELECT * FROM material WHERE id = %s", GetSQLValueString($colname_get_material_by_id, "int"));
$get_material_by_id = mysql_query($query_get_material_by_id, $drycleaners_conn) or die(mysql_error());
$row_get_material_by_id = mysql_fetch_assoc($get_material_by_id);
$totalRows_get_material_by_id = mysql_num_rows($get_material_by_id);
?>
<?php include"includes/table_settings.php"?>
              
<?php
 if($_REQUEST['material_delete']==true && $_REQUEST['id']!=""){
 
 $query_remove_record="update material set record_status='deactivated', deleted_by='".$loggedin_id."',  deleted_date='".date("y-m-d")."' where material.id='".$_REQUEST["id"]."'";
 mysql_query($query_remove_record,$drycleaners_conn) or die(mysql_error());
 if(mysql_affected_rows($drycleaners_conn)>0){
	 redirect_delete("user_view","2",$_REQUEST["id"]);
	 }
 }
?>        

              <table cellpadding="0" cellspacing="0" border="0" id="dataTable">
                <thead>
                  <tr>
                    <th>Id</th>
                    <th>Material Name</th>
                    <th></th>
                    <th></th>
                    <th></th>
                  </tr>
                </thead>
                <tbody>
                  <!--Loop start, you could use a repeat region here-->
  <?php do{?>
    <!--Loop start, you could use a repeat region here-->
    <tr>
      <td><?php echo $row_get_material['id']?></td>
      <td><?php echo $row_get_material['name']?></td>
          <td><a href=".?<?php get_child_link("0000-00-00 00:00:00","material_service_cost_view","material_service_cost_view");?>= true&amp;material_id=<?php echo $row_get_material['id']; ?>&back_page=material_view"><input name="" value="Service Cost" type="submit" id="edit_forms" style="width:auto;" /></a></td>
      <td align="center"><a href=".?material= &amp;material_edit= true&amp;id=<?php echo $row_get_material['id']; ?>&action=Edit"><input name="" value="Edit" type="submit" id="edit_forms"/></a></td>
      <td align="center"><a href=".?material_view&amp;material_delete=true&id=<?php echo $row_get_material['id']; ?>"><input name="" value="Delete" type="submit" id="delete_forms"/></a></td>
    </tr>
    <?php }while($row_get_material=mysql_fetch_assoc($get_material));?>
                  <!--Loop end-->
                </tbody>
              </table>
<?php
mysql_free_result($get_material);

mysql_free_result($get_material_by_id);
?>
</div>